﻿@{
    Layout = null;
}
@using ZBJF.Warranty.BLL
@using ZBJF.Warranty.Common.Enums
@using ZBJF.Warranty.Model
@model List<ZBJF.Warranty.Model.SellersOrganization>
    @foreach (var item in Model.Where(m => m.ParentOrganizationId == ViewBag.Pid).OrderBy(o=>o.CreateTime))
    {
        int layer = ViewBag.Layer;
        var paddingLeft = 30 * layer + "px";
        <tr layer="@layer">
            <td class="category">
                <span class="close" attr-id="close" style="margin-left: @paddingLeft" onclick="categoryTree(this, @layer)"></span>
                @item.OrganizationName
            </td>
            <td>@(ServiceFactory.SellersTypeServiceInstance.GetSellersTypeById(item.SellerType).SellerTypeName)</td>
            <td>
                @if (item.IsAvailable == true)
                {
                    <i class="icon-ok green bigger-120"></i>
                }
                else
                {
                    <i class="icon-remove red bigger-120"></i>
                }
            </td>
            <td>@item.CreateTime.ToString("yyyy-MM-dd hh:mm:ss")</td>
            <td>@item.Sort</td>
            <td>
                <a href="javascript:ShowEidtDialog('@item.ID')" class="Edit-R" title="编辑"><i class="icon-pencil green bigger-120"></i></a>                
                <a href="javascript:DeleteObj('@item.ID','/SellersOrganization/DeleteSellersOrganization','')" class="Delete-R" title="删除"><i class="icon-trash red bigger-120"></i></a>
            </td>
        </tr>
          var childMenu = Model.Where(m => m.ParentOrganizationId == item.ID).OrderBy(o => o.Sort).ToList();
            layer = layer + 1;
            if (childMenu.Any())
            {
                @Html.Action("ShowMenuList", "SellersOrganization", new { listPage = Model, pid = item.ID, layer = layer })
            }
            layer = layer - 1;
    }